*** Keywords ***
登录
    Open Browser    http://172.23.7.30:5005/    Chrome
    Sleep    1s
    Maximize Browser Window
    Input Text    id=home_login_username    haoyamin
    Input Password    id=home_login_password    @Hbgydxsx105006
    Click Element    id=home_login_submit
    Sleep    3s
    Wait Until Page Contains    航班管理

*** Settings ***
Library           SeleniumLibrary
Library           DateTime

*** Test Cases ***
国内航班航班起飞
    登录
    ${title}    Get Title
    log    ${title}
    Click Element    //*[@id="LAY-system-side-menu"]/li[1]/dl/dd[4]/a    # 进去菜单航班起降
    sleep    3S
    select frame    xpath=/html/body/div[1]/div/div[4]/div[2]/iframe
    sleep    3S
    Click Button    xpath=/html/body/div/div/button[1]    #点击【起飞航班】
    Unselect Frame
    sleep    3s
    Select Frame    id=layui-layer-iframe3
    sleep    3s
    Click Element    xpath=/html/body/div/div[1]/div[1]/div/div/div/input    #打开航司下拉框
    Click Element    xpath=/html/body/div/div[1]/div[1]/div/div/dl/dd[5]    #选择海航
    Input Text    xpath=/html/body/div/div[1]/div[2]/div/input    BD53    #输入机尾号
    ${time}    Get Time    epoch    #获取时间戳
    log    ${time}
    Input Text    xpath=/html/body/div/div[1]/div[3]/div/input    hym${time}    输入航节号
    Input Text    xpath=/html/body/div/div[1]/div[4]/div/input    ${time}    #输入航班号
    Click Element    xpath=/html/body/div[1]/div[1]/div[5]/div/div/div/input    #打开航班类型下拉框
    Click Element    xpath=/html/body/div/div[1]/div[5]/div/div/dl/dd[2]    #选择国内航班
    ${date}    Get Current Date    result_format=%Y-%m-%d
    Input Text    xpath=/html/body/div/div[1]/div[6]/div/input    ${date}
    Input Text    name=originIATA    PEK    #选择起飞地为“北京”
    Input Text    name=destinationIATA    HGH    #选择起飞地为“杭州”
    Click Element    xpath=/html/body/div[1]/div[1]/div[9]/div/input    #打开起飞时间选择框
    Click Element    xpath=/html/body/div[2]/div[2]/div/span[2]    #选择起飞时间为现在
    ${time2}    Add Time To Date    ${time}    6 hour    %Y-%m-%d %H:%M:%S
    Input Text    xpath=/html/body/div/div[1]/div[10]/div/input    ${time2}    #起飞时间加6小时
    #Comment    Click Element    xpath=/html/body/div[2]/div[2]/div/span[3]    #点击【确定】
    Click Element    xpath=/html/body/div/div[1]    #关闭达到时间弹框
    sleep    5s
    Unselect Frame
    Click Element    xpath=/html/body/div[4]/div[3]/a[1]    #确定起飞航班
    sleep    5s
    Close Browser

time
    ${time}    Get Time    format=%Y%m%d%H%M%S
    log    ${time}
    ${time2}    Add Time To Date    ${time}    6 hour    %Y-%m-%d %H:%M:%S
    log    ${time2}
    ${date}    Get Current Date    result_format=%Y-%m-%d
    log    ${date}

国际长航班航班起飞
    登录
    ${title}    Get Title
    log    ${title}
    Click Element    //*[@id="LAY-system-side-menu"]/li[1]/dl/dd[4]/a    # 进去菜单航班起降
    sleep    3S
    select frame    xpath=/html/body/div[1]/div/div[4]/div[2]/iframe
    sleep    3S
    Click Button    xpath=/html/body/div/div/button[1]    #点击【起飞航班】
    Unselect Frame
    sleep    3s
    Select Frame    id=layui-layer-iframe3
    sleep    3s
    Click Element    xpath=/html/body/div/div[1]/div[1]/div/div/div/input    #打开航司下拉框
    Click Element    xpath=/html/body/div/div[1]/div[1]/div/div/dl/dd[5]    #选择海航
    Input Text    xpath=/html/body/div/div[1]/div[2]/div/input    BD53    #输入机尾号
    ${time}    Get Time    epoch    #获取时间戳
    log    ${time}
    Input Text    xpath=/html/body/div/div[1]/div[3]/div/input    hym${time}    输入航节号
    Input Text    xpath=/html/body/div/div[1]/div[4]/div/input    ${time}    #输入航班号
    Click Element    xpath=/html/body/div[1]/div[1]/div[5]/div/div/div/input    #打开航班类型下拉框
    Click Element    xpath=/html/body/div/div[1]/div[5]/div/div/dl/dd[3]    #选择国际航班
    ${date}    Get Current Date    result_format=%Y-%m-%d
    Input Text    xpath=/html/body/div/div[1]/div[6]/div/input    ${date}
    Input Text    name=originIATA    PEK    #选择起飞地为“北京”
    Input Text    name=destinationIATA    SFO    #选择起飞地为“杭州”
    Click Element    xpath=/html/body/div[1]/div[1]/div[9]/div/input    #打开起飞时间选择框
    Click Element    xpath=/html/body/div[2]/div[2]/div/span[2]    #选择起飞时间为现在
    ${time2}    Add Time To Date    ${time}    8 hour    %Y-%m-%d %H:%M:%S
    Input Text    xpath=/html/body/div/div[1]/div[10]/div/input    ${time2}    #起飞时间加6小时
    #Comment    Click Element    xpath=/html/body/div[2]/div[2]/div/span[3]    #点击【确定】
    Click Element    xpath=/html/body/div/div[1]    #关闭达到时间弹框
    sleep    5s
    Unselect Frame
    Click Element    xpath=/html/body/div[4]/div[3]/a[1]    #确定起飞航班
    sleep    5s
    Close Browser

国际短航班航班起飞
    登录
    ${title}    Get Title
    log    ${title}
    Click Element    //*[@id="LAY-system-side-menu"]/li[1]/dl/dd[4]/a    # 进去菜单航班起降
    sleep    3S
    select frame    xpath=/html/body/div[1]/div/div[4]/div[2]/iframe
    sleep    3S
    Click Button    xpath=/html/body/div/div/button[1]    #点击【起飞航班】
    Unselect Frame
    sleep    3s
    Select Frame    id=layui-layer-iframe3
    sleep    3s
    Click Element    xpath=/html/body/div/div[1]/div[1]/div/div/div/input    #打开航司下拉框
    Click Element    xpath=/html/body/div/div[1]/div[1]/div/div/dl/dd[5]    #选择海航
    Input Text    xpath=/html/body/div/div[1]/div[2]/div/input    BD53    #输入机尾号
    ${time}    Get Time    epoch    #获取时间戳
    log    ${time}
    Input Text    xpath=/html/body/div/div[1]/div[3]/div/input    hym${time}    输入航节号
    Input Text    xpath=/html/body/div/div[1]/div[4]/div/input    ${time}    #输入航班号
    Click Element    xpath=/html/body/div[1]/div[1]/div[5]/div/div/div/input    #打开航班类型下拉框
    Click Element    xpath=/html/body/div/div[1]/div[5]/div/div/dl/dd[3]    #选择国际航班
    ${date}    Get Current Date    result_format=%Y-%m-%d
    Input Text    xpath=/html/body/div/div[1]/div[6]/div/input    ${date}
    Input Text    name=originIATA    PEK    #选择起飞地为“北京”
    Input Text    name=destinationIATA    SFO    #选择起飞地为“杭州”
    Click Element    xpath=/html/body/div[1]/div[1]/div[9]/div/input    #打开起飞时间选择框
    Click Element    xpath=/html/body/div[2]/div[2]/div/span[2]    #选择起飞时间为现在
    ${time2}    Add Time To Date    ${time}    4 hour    %Y-%m-%d %H:%M:%S
    Input Text    xpath=/html/body/div/div[1]/div[10]/div/input    ${time2}    #起飞时间加6小时
    #Comment    Click Element    xpath=/html/body/div[2]/div[2]/div/span[3]    #点击【确定】
    Click Element    xpath=/html/body/div/div[1]    #关闭达到时间弹框
    sleep    5s
    Unselect Frame
    Click Element    xpath=/html/body/div[4]/div[3]/a[1]    #确定起飞航班
    sleep    5s
    Close Browser
